package edu.whu.zqm.assignment7.controller;

import edu.whu.zqm.assignment7.monitor.ServiceMonitor;
import edu.whu.zqm.assignment7.monitor.ServiceMonitorData;
import edu.whu.zqm.assignment7.service.myService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class Controller {
    private final myService myService;
    private final ServiceMonitor serviceMonitor;

    public Controller(myService myService,  ServiceMonitor serviceMonitor) {
        this.myService = myService;
        this.serviceMonitor = serviceMonitor;
    }

    @GetMapping("/monitor_data")
    public Map<String, ServiceMonitorData> getMonitorData() {
        return serviceMonitor.getMonitorData();
    }

    @GetMapping("/hello")
    public void hello() {
        myService.hello();
    }

    @GetMapping("/eat")
    public void eat() {
        myService.eat();
    }

    @GetMapping("/bye")
    public void bye() {
        myService.bye();
    }

}
